/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * UpLevelPanel.java
 *
 * Created on 15-09-2014, 10:23:55
 */
package demochess;

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 *
 * @author Nhattruong
 */
public class UpLevelPanel extends javax.swing.JPanel {

    private int selectedChess = 0;

    /** Creates new form UpLevelPanel */
    public UpLevelPanel() {
        initComponents();
        btnQueen.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                btnRook.setBackground(new Color(240, 240, 240));
                btnKnight.setBackground(new Color(240, 240, 240));
                btnBishop.setBackground(new Color(240, 240, 240));
                btnQueen.setBackground(new Color(255, 156, 156));
                selectedChess = 0;
            }
        });
        btnKnight.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                btnRook.setBackground(new Color(240, 240, 240));
                btnQueen.setBackground(new Color(240, 240, 240));
                btnBishop.setBackground(new Color(240, 240, 240));
                btnKnight.setBackground(new Color(255, 156, 156));
                selectedChess = 2;
            }
        });
        btnRook.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                btnQueen.setBackground(new Color(240, 240, 240));
                btnKnight.setBackground(new Color(240, 240, 240));
                btnBishop.setBackground(new Color(240, 240, 240));
                btnRook.setBackground(new Color(255, 156, 156));
                selectedChess = 1;
            }
        });
        btnBishop.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                btnRook.setBackground(new Color(240, 240, 240));
                btnKnight.setBackground(new Color(240, 240, 240));
                btnQueen.setBackground(new Color(240, 240, 240));
                btnBishop.setBackground(new Color(255, 156, 156));
                selectedChess = 3;
            }
        });
    }

    public int getSelectedChess() {
        return selectedChess;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btnBishop = new javax.swing.JButton();
        btnKnight = new javax.swing.JButton();
        btnRook = new javax.swing.JButton();
        btnQueen = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        btnBishop.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/chess-bishop-icon w.png"))); // NOI18N

        btnKnight.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/chess-knight-icon w.png"))); // NOI18N

        btnRook.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/chess-rook-icon w.png"))); // NOI18N

        btnQueen.setBackground(new java.awt.Color(255, 156, 156));
        btnQueen.setIcon(new javax.swing.ImageIcon(getClass().getResource("/icon/chess-queen-icon w.png"))); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabel1.setText("Choose your chess");

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(btnQueen)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRook)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnBishop)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnKnight)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnBishop)
                    .addComponent(btnKnight)
                    .addComponent(btnRook)
                    .addComponent(btnQueen))
                .addGap(40, 40, 40))
        );
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnBishop;
    private javax.swing.JButton btnKnight;
    private javax.swing.JButton btnQueen;
    private javax.swing.JButton btnRook;
    private javax.swing.JLabel jLabel1;
    // End of variables declaration//GEN-END:variables
}
